//
//  NotifiXiaoXiDetailViewController.m
//  CarPark
//
//  Created by oceans on 2019/8/27.
//  Copyright © 2019 oceans. All rights reserved.
//

#import "NotifiXiaoXiDetailViewController.h"

@interface NotifiXiaoXiDetailViewController ()

@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UILabel *dateLabel;
@property (strong, nonatomic) UITextView *text;
@end

@implementation NotifiXiaoXiDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupView];
    
    [self loadData];
}

- (void)setupView {
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.navigationItem.title = @"详情";
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, XNavigationHeight+5.0, ScreenWidth, 20.0)];
    _titleLabel.font = [UIFont systemFontOfSize:14.0];
    _titleLabel.textColor = [UIColor blackColor];
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:_titleLabel];
    
    self.dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_titleLabel.frame)+5.0, ScreenWidth, 15.0)];
    _dateLabel.font = [UIFont systemFontOfSize:11.0];
    _dateLabel.textColor = COLOR(153, 153, 153, 1);
    _dateLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:_dateLabel];
    
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, XNavigationHeight+50.0, ScreenWidth, 0.5)];
    line.backgroundColor = COLOR(231, 231, 231, 1);
    [self.view addSubview:line];
    
    self.text = [[UITextView alloc] initWithFrame:CGRectMake(0, XNavigationHeight+51.0, ScreenWidth, ScreenHeight-XNavigationHeight-51.0)];
    _text.editable = NO;
    [self.view addSubview:_text];
}

- (void)loadData {
    
    defweakself
    [HttpRequest getURL:[NSString stringWithFormat:knotifi_notifi_detail, __id] paras:nil showProgress:NO successful:^(id  _Nullable result) {
        NSLog(@"%@", result);
        weakself.titleLabel.text = result[@"datas"][@"title"];
        weakself.dateLabel.text = result[@"datas"][@"created_at"];
        weakself.text.text = result[@"datas"][@"content"];
    } failed:^(int code, NSString * _Nullable errMsg) {
        
    }];
}

@end
